perm filename THEORY.XGP[F76,JMC] blob
sn#249279 filedate 1976-11-30 generic text, type T, neo UTF8
/LMAR=0/XLINE=3/FONT#0=BAXL30/FONT#1=BDR30/FONT#2=BAXM30/FONT#3=BASB30/FONT#4=BDR30/FONT#5=SUB/FONT#6=SUP/FONT#9=FIX40/FONT#10=FIX30/FONT#11=GRFX25/FONT#12=GRFX35
␈↓ ↓H␈↓␈↓ εP␈↓ I1
␈↓ ↓H␈↓β␈↓ ¬yCHAPTER I
␈↓ ↓H␈↓β␈↓ ∧0PROVING LISP PROGRAMS CORRECT
␈↓ ↓H␈↓ In␈α∪this␈α∪chapter␈α∩we␈α∪will␈α∪introduce␈α∩techniques␈α∪for␈α∪proving␈α∩LISP␈α∪programs␈α∪correct.␈α∩ The
␈↓ ↓H␈↓techniques␈α
will␈α
mainly␈α
be␈α
limited␈α
to␈α
what␈α∞we␈α
may␈α
call␈α
␈↓αclean␈↓␈α
LISP␈α
programs.␈α
In␈α∞particular,␈α
there
␈↓ ↓H␈↓must␈α∞be␈α∞no␈α
side␈α∞effects,␈α∞because␈α
our␈α∞methods␈α∞depend␈α
on␈α∞the␈α∞ability␈α
to␈α∞replace␈α∞subexpressions␈α
by
␈↓ ↓H␈↓equal expressions.
␈↓ ↓H␈↓ The␈α
necessary␈α
basic␈α
facts␈α
can␈α
be␈α
divided␈α
into␈α
several␈α
categories:␈α
first␈α
order␈α
logic␈α
including
␈↓ ↓H␈↓conditional␈αforms␈αand␈αfirst␈αorder␈αlambda-expressions,␈αalgebraic␈αfacts␈αabout␈αlists␈αand␈αS-expressions,
␈↓ ↓H␈↓facts␈α∂about␈α∂the␈α∂inductive␈α∂structure␈α∂of␈α∂lists␈α∂and␈α∂S-expressions,␈α∂and␈α∂general␈α∂facts␈α⊂about␈α∂functions
␈↓ ↓H␈↓defined␈α⊃by␈α⊃recursion.␈α⊂ Ideally,␈α⊃we␈α⊃would␈α⊃use␈α⊂a␈α⊃general␈α⊃theory␈α⊂of␈α⊃recursive␈α⊃definition␈α⊃to␈α⊂prove
␈↓ ↓H␈↓theorems␈αabout␈αLISP␈αfunctions.␈α However,␈αthe␈αgeneral␈αtheory␈αis␈αnot␈αwell␈αenough␈αdeveloped,␈αso␈αwe
␈↓ ↓H␈↓have␈α⊂had␈α∂to␈α⊂introduce␈α⊂some␈α∂methods␈α⊂limited␈α⊂to␈α∂LISP␈α⊂functions␈α⊂defined␈α∂by␈α⊂particular␈α⊂kinds␈α∂of
␈↓ ↓H␈↓recursion schemes.
␈↓ ↓H␈↓1. ␈↓βFirst order logic with conditional forms and lambda-expressions.␈↓
␈↓ ↓H␈↓ The␈α⊂logic␈α⊂we␈α⊂shall␈α⊂use␈α⊂is␈α⊂called␈α⊂first␈α⊂order␈α⊂logic␈α⊂with␈α⊂equality,␈α⊂but␈α⊂we␈α⊂will␈α⊂extend␈α⊂it␈α⊂by
␈↓ ↓H␈↓allowing␈α
conditional␈α
forms␈αto␈α
be␈α
terms␈αand␈α
lambda-expressions␈α
to␈αbe␈α
function␈α
expressions.␈α From
␈↓ ↓H␈↓the␈α∂mathematical␈α⊂point␈α∂of␈α⊂view,␈α∂these␈α⊂extensions␈α∂are␈α∂inessential,␈α⊂because,␈α∂as␈α⊂we␈α∂shall␈α⊂see,␈α∂every
␈↓ ↓H␈↓sentence␈αthat␈αincludes␈αconditional␈αforms␈αor␈αfirst␈αorder␈αlambdas␈αcan␈αreadily␈αbe␈αtransformed␈αinto␈αan
␈↓ ↓H␈↓equivalent␈αsentence␈αwithout␈αthem.␈α However,␈αthe␈αextensions␈αare␈αpractically␈αimportant,␈αbecause␈αthey
␈↓ ↓H␈↓permit␈α
us␈α
to␈α
use␈α
certain␈α
recursive␈α∞definitions␈α
directly␈α
as␈α
formulas␈α
of␈α
the␈α
logic.␈α∞ Unfortunately,␈α
we
␈↓ ↓H␈↓will␈α
not␈αbe␈α
able␈α
to␈αtreat␈α
all␈α
recursive␈αdefinitions␈α
in␈αthis␈α
system,␈α
but␈αonly␈α
those␈α
which␈αwe␈α
can␈αbe␈α
sure
␈↓ ↓H␈↓are␈α∂defined␈α∞for␈α∂all␈α∞values␈α∂of␈α∞the␈α∂arguments.␈α∞ Moreover,␈α∂we␈α∞will␈α∂be␈α∞unable␈α∂to␈α∂prove␈α∞definedness
␈↓ ↓H␈↓within␈α∞the␈α
system,␈α∞so␈α∞we␈α
will␈α∞be␈α∞restricted␈α
to␈α∞classes␈α
of␈α∞recursive␈α∞definitions␈α
which␈α∞we␈α∞can␈α
prove
␈↓ ↓H␈↓always␈α
defined␈α
by␈α
an␈α
argument␈α∞outside␈α
the␈α
system.␈α
Fortunately,␈α
many␈α
interesting␈α∞LISP␈α
functions
␈↓ ↓H␈↓meet␈α∂these␈α∂restrictions␈α∂including␈α⊂all␈α∂the␈α∂important␈α∂functions␈α∂so␈α⊂far␈α∂used␈α∂except␈α∂for␈α∂␈↓αeval␈↓␈α⊂and␈α∂its
␈↓ ↓H␈↓variants.
␈↓ ↓H␈↓ Formulas␈α⊂of␈α⊂the␈α⊂logic␈α⊂are␈α⊂built␈α⊂from␈α⊂constants,␈α⊂variables␈α⊂predicate␈α⊂symbols,␈α⊂and␈α∂function
␈↓ ↓H␈↓symbols␈α⊃using␈α⊃function␈α∩application,␈α⊃conditional␈α⊃forms,␈α∩boolean␈α⊃forms,␈α⊃lambda␈α∩expressions,␈α⊃and
␈↓ ↓H␈↓quantifiers.
␈↓ ↓H␈↓␈↓βConstants␈↓:␈α∂We␈α∂will␈α∂use␈α∂S-expresssions␈α∂as␈α∞constants␈α∂standing␈α∂for␈α∂themselves␈α∂and␈α∂also␈α∂lower␈α∞case
␈↓ ↓H␈↓letters␈α∪from␈α∪the␈α∪first␈α∀part␈α∪of␈α∪the␈α∪alphabet␈α∪to␈α∀represent␈α∪constants␈α∪in␈α∪other␈α∪domains␈α∀than␈α∪S-
␈↓ ↓H␈↓expressions.
␈↓ ↓H␈↓␈↓βVariables␈↓: We will use the letters ␈↓αu␈↓ thru ␈↓αz␈↓ with or without subscripts as variables.
␈↓ ↓H␈↓␈↓ ¬wCHAPTER I␈↓ I2
␈↓ ↓H␈↓␈↓βFunction␈αsymbols␈↓:␈αThe␈αletters␈α␈↓αf␈↓,␈α␈↓αg␈↓␈αand␈α␈↓αh␈↓␈αwith␈αor␈αwithout␈αsubscripts␈αare␈αused␈αas␈αfunction␈αsymbols.
␈↓ ↓H␈↓The␈αLISP␈αfunction␈αsymbols␈α␈↓βa␈↓,␈α␈↓βd␈↓␈α
and␈α.␈α(as␈αan␈αinfix)␈αare␈α
also␈αused␈αas␈αfunction␈αsymbols.␈α We␈α
suppose
␈↓ ↓H␈↓that each function symbol takes the same definite number of arguments every time it is used.
␈↓ ↓H␈↓␈↓βPredicate␈αsymbols␈↓:␈αThe␈αletters␈α␈↓αp␈↓,␈α␈↓αq␈↓␈αand␈α␈↓αr␈↓␈αwith␈αor␈αwithout␈αsubscripts␈αare␈αused␈αas␈αpredicate␈α
symbols.
␈↓ ↓H␈↓We␈α
will␈α
also␈α
use␈α
the␈αLISP␈α
predicate␈α
symbol␈α
␈↓βat␈↓␈α
as␈αa␈α
constant␈α
predicate␈α
symbol.␈α
The␈αequality␈α
symbol
␈↓ ↓H␈↓=␈αis␈αalso␈αused␈αas␈αan␈αinfix.␈α We␈αsuppose␈αthat␈αeach␈αpredicate␈αsymbol␈αtakes␈αthe␈αsame␈αdefinite␈αnumber
␈↓ ↓H␈↓of arguments each time it is used.
␈↓ ↓H␈↓ Next␈α
we␈α
define␈α
terms,␈α
sentences,␈α
function␈α
expressions␈α
and␈α
predicate␈α
expressions␈αinductively.
␈↓ ↓H␈↓A␈αterm␈α
is␈αan␈α
expression␈αwhose␈α
value␈αwill␈α
be␈αan␈αobject␈α
like␈αan␈α
S-expression␈αor␈α
a␈αnumber␈α
while␈αa
␈↓ ↓H␈↓sentence␈α
has␈α
value␈α
␈↓∧T␈↓␈α
or␈α␈↓∧F␈↓.␈α
Terms␈α
are␈α
used␈α
in␈α
making␈αsentences,␈α
and␈α
sentences␈α
occur␈α
in␈α
terms␈αso
␈↓ ↓H␈↓that␈α∀the␈α∀definitions␈α∀are␈α∀␈↓αmutually␈α∀recursive␈↓␈α∃where␈α∀this␈α∀use␈α∀of␈α∀the␈α∀word␈α∀␈↓αrecursive␈↓␈α∃should␈α∀be
␈↓ ↓H␈↓distinguished␈α⊃from␈α⊃its␈α⊃use␈α⊃in␈α⊃recursive␈α⊃definitions␈α⊃of␈α⊃functions.␈α⊃ Function␈α⊃expressions␈α⊃are␈α⊃also
␈↓ ↓H␈↓involved in the mutual recursion.
␈↓ ↓H␈↓␈↓βTerms␈↓:␈α∩Constants␈α⊃are␈α∩terms,␈α⊃and␈α∩variables␈α⊃are␈α∩terms.␈α⊃ If␈α∩␈↓αf␈↓␈α⊃is␈α∩a␈α⊃function␈α∩expression␈α∩taking␈α⊃␈↓αn␈↓
␈↓ ↓H␈↓arguments,␈αand␈α␈↓αt␈↓¬1␈↓α, ... ,t␈↓¬n␈↓α␈↓␈αare␈αterms,␈αthen␈α␈↓αf[t␈↓¬1␈↓α, ... ,t␈↓¬n␈↓α]␈↓␈αis␈αa␈αterm.␈α If␈α␈↓αp␈↓␈αis␈αa␈αsentence␈αand␈α␈↓αt␈↓¬1␈↓α␈↓␈αand␈α
␈↓αt␈↓¬2␈↓
␈↓ ↓H␈↓are␈α∂terms,␈α∞then␈α∂␈↓βif␈↓α p ␈↓βthen␈↓α t␈↓¬1␈↓α ␈↓βelse␈↓α t␈↓¬2␈↓␈α∞is␈α∂a␈α∞term.␈α∂ We␈α∞soften␈α∂the␈α∞notation␈α∂by␈α∞allowing␈α∂infix␈α∞symbols
␈↓ ↓H␈↓where this is customary.
␈↓ ↓H␈↓␈↓βSentences␈↓:␈α∩If␈α⊃␈↓αp␈↓␈α∩is␈α⊃a␈α∩predicate␈α⊃expression␈α∩taking␈α⊃␈↓αn␈↓␈α∩arguments␈α⊃and␈α∩␈↓αt␈↓¬1␈↓α, ... ,t␈↓¬n␈↓α␈↓␈α⊃are␈α∩terms,␈α⊃then
␈↓ ↓H␈↓␈↓αp[t␈↓¬1␈↓α, ... ,t␈↓¬n␈↓α]␈↓␈αis␈αa␈αsentence.␈α Equality␈αis␈αalso␈αused␈αas␈αan␈αinfixed␈αpredicate␈αsymbol␈αto␈αform␈α
sentences,
␈↓ ↓H␈↓i.e.␈α
␈↓αt␈↓¬1␈↓α = t␈↓¬2␈↓␈α
is␈α
a␈α
sentence.␈α
If␈α
␈↓αp␈↓␈α
is␈α
a␈α
sentence,␈αthen␈α
␈↓α¬p␈↓␈α
is␈α
also␈α
a␈α
sentence.␈α
If␈α
␈↓αp␈↓␈α
and␈α
␈↓αq␈↓␈α
are␈αsentences,
␈↓ ↓H␈↓then␈α␈↓αp∧q␈↓,␈α␈↓αp∨q␈↓,␈α␈↓αp⊃q␈↓,␈αand␈α␈↓αp≡q␈↓␈αare␈αsentences.␈α If␈α␈↓αp␈↓,␈α␈↓αq␈↓␈αand␈α␈↓αr␈↓␈αare␈αsentences,␈αthen␈α␈↓βif␈↓α p ␈↓βthen␈↓α q ␈↓βelse␈↓α r␈↓␈αis␈αa
␈↓ ↓H␈↓sentence.␈α⊃ If␈α⊃␈↓αx␈↓¬1␈↓α, ..., x␈↓¬n␈↓α␈↓␈α⊃are␈α∩variables,␈α⊃and␈α⊃␈↓αp␈↓␈α⊃is␈α⊃a␈α∩term,␈α⊃then␈α⊃␈↓α∀x␈↓¬1␈↓α ... x␈↓¬n␈↓α:t␈↓␈α⊃and␈α∩␈↓α∀x␈↓¬1␈↓α ... x␈↓¬n␈↓α:t␈↓␈α⊃are
␈↓ ↓H␈↓sentences.
␈↓ ↓H␈↓␈↓βFunction␈α∂expressions␈↓:␈α∂A␈α∞function␈α∂symbol␈α∂is␈α∞a␈α∂function␈α∂expression.␈α∞ If␈α∂␈↓αx␈↓¬1␈↓α, ... ,x␈↓¬n␈↓α␈↓␈α∂are␈α∞variables
␈↓ ↓H␈↓and ␈↓αt␈↓ is a term, then ␈↓α[λx␈↓¬1␈↓α, ... ,x␈↓¬n␈↓α:t]␈↓ is a function expression.
␈↓ ↓H␈↓␈↓βPredicate␈α
expressions␈↓:␈α
A␈α
predicate␈αsymbol␈α
is␈α
a␈α
predicate␈αexpression.␈α
If␈α
␈↓αx␈↓¬1␈↓α, ... ,x␈↓¬n␈↓α␈↓␈α
are␈αvariables
␈↓ ↓H␈↓and ␈↓αp␈↓ is a sentence, then ␈↓α[λx␈↓¬1␈↓α, ... ,x␈↓¬n␈↓α:p]␈↓ is a predicate expression.
␈↓ ↓H␈↓ An␈α
occurrence␈α
of␈αa␈α
variable␈α
␈↓αx␈↓␈αis␈α
called␈α
bound␈αif␈α
it␈α
is␈αin␈α
an␈α
expression␈αof␈α
one␈α
of␈α
the␈αforms
␈↓ ↓H␈↓␈↓α[λx␈↓¬1␈↓α ... x␈↓¬n␈↓α:t]␈↓,␈α␈↓α[λx␈↓¬1␈↓α ... x␈↓¬n␈↓α:p]␈↓,␈α␈↓α[∀x␈↓¬1␈↓α ... x␈↓¬n␈↓α:p]␈↓␈αor␈α␈↓α[∃x␈↓¬1␈↓α ... x␈↓¬n␈↓α:p]␈↓␈αwhere␈α␈↓αx␈↓␈αis␈αone␈αof␈αthe␈αnumbered␈α␈↓αx␈↓'s.␈α If
␈↓ ↓H␈↓not bound an occurrence is called free.
␈↓ ↓H␈↓ The␈α∞␈↓αsemantics␈↓␈α
of␈α∞first␈α
order␈α∞logic␈α
consists␈α∞of␈α∞the␈α
rules␈α∞that␈α
enable␈α∞us␈α
to␈α∞determine␈α∞when␈α
a
␈↓ ↓H␈↓sentence␈αis␈αtrue␈α
and␈αwhen␈αit␈αis␈α
false.␈α However,␈αthe␈αtruth␈α
or␈αfalsity␈αof␈αa␈α
sentence␈αis␈αrelative␈α
to␈αthe
␈↓ ↓H␈↓interpretation␈αassigned␈αto␈αthe␈αconstants,␈αthe␈α
function␈αand␈αpredicate␈αsymbols␈αand␈αthe␈α
free␈αvariables
␈↓ ↓H␈↓of the formula. We proceed as follows:
␈↓ ↓H␈↓ We␈α
begin␈α
by␈αchoosing␈α
a␈α
domain.␈α In␈α
most␈α
cases␈αwe␈α
shall␈α
consider␈αthe␈α
domain␈α
will␈αinclude␈α
the
␈↓ ↓H␈↓S-expressions␈αand␈αany␈αS-expression␈αconstants␈αappearing␈αin␈αthe␈αformula␈αstand␈αfor␈αthemselves.␈α We
␈↓ ↓H␈↓will␈α
allow␈α∞for␈α
the␈α∞possibility␈α
that␈α∞other␈α
objects␈α
than␈α∞S-expressions␈α
exist,␈α∞and␈α
some␈α∞constants␈α
may
␈↓ ↓H␈↓designate␈α⊂them.␈α⊂ Each␈α⊂function␈α⊂or␈α⊂predicate␈α⊃symbol␈α⊂is␈α⊂assigned␈α⊂a␈α⊂function␈α⊂or␈α⊂predicate␈α⊃on␈α⊂the
␈↓ ↓H␈↓␈↓ ¬wCHAPTER I␈↓ I3
␈↓ ↓H␈↓domain.␈α↔ We␈α⊗will␈α↔normally␈α⊗assign␈α↔to␈α⊗the␈α↔basic␈α⊗LISP␈α↔function␈α⊗and␈α↔predicate␈α↔symbols␈α⊗the
␈↓ ↓H␈↓corresponding␈αbasic␈αLISP␈αfunctions␈αand␈αpredicates.␈α Each␈αvariable␈αappearing␈αfree␈αin␈αa␈αsentence␈αis
␈↓ ↓H␈↓also␈αassigned␈αan␈αelemet␈αof␈αthe␈αdomain.␈α All␈αthese␈αassignments␈αconstitute␈αan␈αinterpretation,␈αand␈αthe
␈↓ ↓H␈↓truth of a sentence is relative to the interpretation.
␈↓ ↓H␈↓ The␈α⊃truth␈α⊃of␈α⊂a␈α⊃sentence␈α⊃is␈α⊃determined␈α⊂from␈α⊃the␈α⊃values␈α⊂of␈α⊃its␈α⊃constituents␈α⊃by␈α⊂evaluating
␈↓ ↓H␈↓successively␈α∂larger␈α∂subexpressions.␈α⊂ The␈α∂rules␈α∂for␈α⊂handling␈α∂functions␈α∂and␈α⊂predicates,␈α∂conditional
␈↓ ↓H␈↓expressions,␈α
equality,␈α
and␈α
Boolean␈α
expressions␈αare␈α
exactly␈α
the␈α
same␈α
as␈αthose␈α
we␈α
have␈α
used␈α
in␈αthe
␈↓ ↓H␈↓previous chapters. We need only explain quantifiers:
␈↓ ↓H␈↓ ␈↓α∀x␈↓¬1␈↓α ... x␈↓¬n␈↓α:e␈↓␈α
is␈α
assigned␈αtrue␈α
if␈α
and␈αonly␈α
if␈α
␈↓αe␈↓␈α
is␈αassigned␈α
true␈α
for␈αall␈α
assignments␈α
of␈αelements␈α
of
␈↓ ↓H␈↓the␈α∞domain␈α∞to␈α∞the␈α∞␈↓αx␈↓'s.␈α∞ If␈α∞␈↓αe␈↓␈α∞has␈α∞free␈α∞variables␈α∞that␈α∞are␈α∞not␈α∞among␈α∞the␈α∞␈↓αx␈↓'s,␈α∞then␈α∞the␈α∞truth␈α∞of␈α
the
␈↓ ↓H␈↓sentence␈αdepends␈αon␈αthe␈αvalues␈αassigned␈αto␈αthese␈αremaining␈αfree␈αvariables.␈α ␈↓α∃x␈↓¬1␈↓α ... x␈↓¬n␈↓α:e␈↓␈αis␈αassigned
␈↓ ↓H␈↓true␈αif␈αand␈αonly␈αif␈α␈↓αe␈↓␈αis␈αassigned␈αtrue␈αfor␈α␈↓αsome␈↓␈αassignment␈αof␈αvalues␈αin␈αthe␈αdomain␈αto␈αthe␈α␈↓αx␈↓'s.␈α Free
␈↓ ↓H␈↓variables are handled just as before.
␈↓ ↓H␈↓ ␈↓αλx␈↓¬1␈↓α ... x␈↓¬n␈↓α:u␈↓␈α∩is␈α∩assigned␈α⊃a␈α∩function␈α∩or␈α∩predicate␈α⊃according␈α∩to␈α∩whether␈α∩␈↓αu␈↓␈α⊃is␈α∩a␈α∩term␈α∩or␈α⊃a
␈↓ ↓H␈↓sentence.␈α∞ The␈α∞value␈α∂of␈α∞␈↓α[λx␈↓¬1␈↓α ... x␈↓¬n␈↓α:u][t␈↓¬1␈↓α,...,t␈↓¬n␈↓α]␈α∞is␈α∂obtained␈α∞by␈α∞evaluating␈α∂the␈α∞t␈↓'s␈α∞and␈α∂using␈α∞these
␈↓ ↓H␈↓values␈αas␈αvalues␈α
of␈αthe␈α␈↓αx␈↓'s␈αin␈α
the␈αevaluation␈αof␈α
␈↓αu␈↓.␈α If␈α␈↓αu␈↓␈αhas␈α
free␈αvariables␈αin␈α
addition␈αto␈αthe␈α␈↓αx␈↓'s,␈α
the
␈↓ ↓H␈↓function assigned will depend on them too.
␈↓ ↓H␈↓ Those␈αwho␈αare␈αfamiliar␈αwith␈αthe␈αlambda␈αcalculus␈αshould␈αnote␈αthat␈αλ␈αis␈αbeing␈αused␈αhere␈αin␈αa
␈↓ ↓H␈↓very␈αlimited␈αway.␈α Namely,␈αthe␈αvariables␈αin␈αa␈αlambda-expression␈αtake␈αonly␈αelements␈αof␈αthe␈αdomain
␈↓ ↓H␈↓as␈α
values,␈α
whereas␈αthe␈α
essence␈α
of␈α
the␈αlambda␈α
calculus␈α
is␈α
that␈αthey␈α
take␈α
arbitrary␈α
functions␈αas␈α
values.
␈↓ ↓H␈↓We may call these restricted lambda expressions ␈↓αfirst order lambdas␈↓.
␈↓ ↓H␈↓2. ␈↓βConditional forms.␈↓
␈↓ ↓H␈↓ All the properties we shall use of conditional forms follow from the relation
␈↓ ↓H␈↓ ␈↓α[p ⊃ [␈↓βif␈↓α p ␈↓βthen ␈↓αa ␈↓βelse␈↓α b] = a] ∧ [¬p ⊃ [␈↓βif␈↓α p ␈↓βthen␈↓α a ␈↓βelse␈↓αb] = b]␈↓.
␈↓ ↓H␈↓(If␈αwe␈αweren't␈αadhering␈αto␈αthe␈αrequirement␈αthat␈αall␈αterms␈αbe␈αdefined␈αfor␈αall␈αvalues␈αof␈αthe␈αvariables,
␈↓ ↓H␈↓the situation would be more complicated).
␈↓ ↓H␈↓ It is, however, worthwhile to list separately some properties of conditional forms.
␈↓ ↓H␈↓ First we have the obvious
␈↓ ↓H␈↓ ␈↓βif␈↓∧ T ␈↓βthen␈↓α a ␈↓βelse␈↓α b = a␈↓
␈↓ ↓H␈↓and
␈↓ ↓H␈↓ ␈↓βif␈↓∧ F ␈↓βthen␈↓α a ␈↓βelse␈↓α b = b␈↓.
␈↓ ↓H␈↓␈↓ ¬wCHAPTER I␈↓ I4
␈↓ ↓H␈↓ Next we have a ␈↓αdistributive law␈↓ for functions applied to conditional forms, namely
␈↓ ↓H␈↓ ␈↓αf[␈↓βif␈↓α p ␈↓βthen␈↓α a ␈↓βelse␈↓α b] = ␈↓βif␈↓α p ␈↓βthen␈↓α f[a] ␈↓βelse␈↓α f[b]␈↓.
␈↓ ↓H␈↓This␈αapplies␈αto␈αpredicates␈αas␈αwell␈αas␈αfunctions␈αand␈αcan␈αalso␈αbe␈αused␈αwhen␈αone␈αof␈αthe␈αarguments␈αof
␈↓ ↓H␈↓a␈αfunction␈αof␈α
several␈αarguments␈αis␈αa␈α
conditional␈αform.␈α It␈α
also␈αapplies␈αwhen␈αone␈α
of␈αthe␈αterms␈α
of␈αa
␈↓ ↓H␈↓conditional form is itself a conditional form.
␈↓ ↓H␈↓Thus
␈↓ ↓H␈↓ ␈↓βif␈↓α [␈↓βif␈↓α p ␈↓βthen␈↓α q ␈↓βelse␈↓α r] ␈↓βthen␈↓α a ␈↓βelse␈↓α b = ␈↓βif␈↓α p ␈↓βthen␈↓α [␈↓βif␈↓α q ␈↓βthen␈↓α a ␈↓βelse␈↓α b] ␈↓βelse␈↓α [␈↓βif␈↓α r ␈↓βthen␈↓α a ␈↓βelse␈↓α b]␈↓
␈↓ ↓H␈↓and
␈↓ ↓H␈↓ ␈↓βif␈↓α p ␈↓βthen␈↓α [␈↓βif␈↓α q ␈↓βthen␈↓α a ␈↓βelse␈↓α b] ␈↓βelse␈↓α c = ␈↓βif␈↓α q ␈↓βthen␈↓α [␈↓βif␈↓α p ␈↓βthen␈↓α a ␈↓βelse␈↓α c] ␈↓βelse␈↓α [␈↓βif␈↓α p ␈↓βthen␈↓α b ␈↓βelse␈↓α c]␈↓.
␈↓ ↓H␈↓ When␈α
the␈α
expressions␈α
following␈α
␈↓βthen␈↓␈α
and␈α
␈↓βelse␈↓␈α
are␈α
sentences,␈α
then␈α
the␈α
conditional␈α
form␈α
can
␈↓ ↓H␈↓be replaced by a sentence according to
␈↓ ↓H␈↓ ␈↓α[␈↓βif␈↓α p ␈↓βthen␈↓α q ␈↓βelse␈↓α r] ≡ [p ∧ q] ∨ [¬p ∧ r]␈↓.
␈↓ ↓H␈↓These␈αtwo␈αrules␈αpermit␈αeliminating␈αconditional␈αforms␈αfrom␈αsentences␈αby␈αfirst␈αusing␈αdistributivity␈αto
␈↓ ↓H␈↓move␈αthe␈αconditionals␈αto␈αthe␈α
outside␈αof␈αany␈αfunctions␈αand␈α
then␈αreplacing␈αthe␈αconditional␈αform␈αby␈α
a
␈↓ ↓H␈↓Boolean expression.
␈↓ ↓H␈↓ Note␈αthat␈αthe␈αelimination␈αof␈αconditional␈αforms␈αmay␈αincrease␈αthe␈αsize␈αof␈αa␈αsentence,␈αbecause␈α␈↓αp␈↓
␈↓ ↓H␈↓occurs␈α
twice␈α
in␈α
the␈α
right␈αhand␈α
side␈α
of␈α
the␈α
above␈α
equivalence.␈α In␈α
the␈α
most␈α
unfavorable␈α
case,␈α
␈↓αp␈↓␈αis
␈↓ ↓H␈↓dominates␈α∪the␈α∩size␈α∪of␈α∩the␈α∪expression␈α∩so␈α∪that␈α∩writing␈α∪it␈α∩twice␈α∪almost␈α∩doubles␈α∪the␈α∩size␈α∪of␈α∩the
␈↓ ↓H␈↓expression.
␈↓ ↓H␈↓ Suppose␈α
that␈α
␈↓αa␈↓␈αand␈α
␈↓αb␈↓␈α
in␈α
␈↓βif␈↓α p ␈↓βthen␈↓α a ␈↓βelse␈↓α b␈↓␈αare␈α
expressions␈α
that␈αmay␈α
contain␈α
the␈α
sentence␈α␈↓αp␈↓.
␈↓ ↓H␈↓Occurrences␈αof␈α␈↓αp␈↓␈αin␈α␈↓αa␈↓␈αcan␈αbe␈αreplaced␈αby␈α␈↓∧T␈↓,␈αand␈αoccurrences␈αof␈α␈↓αp␈↓␈αin␈α␈↓αb␈↓␈αcan␈αbe␈αreplaced␈αby␈α␈↓∧F␈↓.␈α This
␈↓ ↓H␈↓follows from the fact that ␈↓αa␈↓ is only evaluated if ␈↓αp␈↓ is true and ␈↓αb␈↓ is evaluated only if ␈↓αp␈↓ is false.
␈↓ ↓H␈↓ This␈α⊃leads␈α⊂to␈α⊃a␈α⊂strengthened␈α⊃form␈α⊂of␈α⊃the␈α⊂law␈α⊃of␈α⊂replacement␈α⊃of␈α⊂equals␈α⊃by␈α⊃equals.␈α⊂ The
␈↓ ↓H␈↓ordinary␈αform␈αof␈αthe␈αlaw␈αsays␈α
that␈αif␈αwe␈αhave␈α␈↓αe = e'␈↓,␈αthen␈αwe␈α
can␈αreplace␈αany␈αoccurrence␈αof␈α␈↓αe␈↓␈αin␈α
an
␈↓ ↓H␈↓expression␈α∩by␈α∩an␈α∩occurrence␈α∩of␈α⊃␈↓αe'␈↓.␈α∩ However,␈α∩if␈α∩we␈α∩want␈α∩to␈α⊃replace␈α∩␈↓αe␈↓␈α∩by␈α∩␈↓αe'␈↓␈α∩within␈α∩␈↓αa␈↓␈α⊃within
␈↓ ↓H␈↓␈↓βif␈↓α p ␈↓βthen␈↓α a ␈↓βelse␈↓α b␈↓,␈α∂then␈α∞we␈α∂need␈α∞only␈α∂prove␈α∞␈↓αp ⊃ e =e'␈↓,␈α∂and␈α∞to␈α∂make␈α∞the␈α∂replacement␈α∞within␈α∂␈↓αb␈↓␈α∞we
␈↓ ↓H␈↓need only prove ␈↓α¬p ⊃ e = e'␈↓.
␈↓ ↓H␈↓ Additional␈α∃facts␈α∃about␈α∃conditional␈α∃forms␈α∃are␈α∃given␈α∃in␈α∃(McCarthy␈α∃1963a)␈α⊗including␈α∃a
␈↓ ↓H␈↓discussion␈αof␈α
canonical␈αforms␈α
that␈αparallels␈αthe␈α
canonical␈αforms␈α
of␈αBoolean␈α
forms.␈α Any␈αquestion␈α
of
␈↓ ↓H␈↓equivalence␈α⊂of␈α⊂conditional␈α∂forms␈α⊂is␈α⊂decidable␈α∂by␈α⊂truth␈α⊂tables␈α∂analogously␈α⊂to␈α⊂the␈α⊂decidability␈α∂of
␈↓ ↓H␈↓Boolean forms.
␈↓ ↓H␈↓␈↓ ¬wCHAPTER I␈↓ I5
␈↓ ↓H␈↓3. ␈↓βLambda-expressions.␈↓
␈↓ ↓H␈↓ The␈α∂only␈α∂additional␈α∂rule␈α∂required␈α∂for␈α∂handling␈α∂lambda-expressions␈α∂in␈α∂first␈α∂order␈α⊂logic␈α∂is
␈↓ ↓H␈↓called ␈↓αlambda-conversion␈↓, essentially
␈↓ ↓H␈↓ ␈↓α[λx:e][a] =␈↓ <the result of substituting ␈↓αe␈↓ for ␈↓αx␈↓ in ␈↓αa␈↓>.
␈↓ ↓H␈↓As examples of this rule, we have
␈↓ ↓H␈↓ ␈↓α[λx:␈↓βa␈↓α x . y][u . v] = [␈↓βa␈↓α[u . v]] . y␈↓.
␈↓ ↓H␈↓However,␈α∞a␈α∞complication␈α
requires␈α∞modifying␈α∞the␈α
rule.␈α∞ Namely,␈α∞we␈α
can't␈α∞substitute␈α∞for␈α∞a␈α
variable
␈↓ ↓H␈↓and␈αexpression␈αthat␈αhas␈αa␈αfree␈αvariable␈αinto␈αa␈αcontext␈αin␈αwhich␈αthat␈αfree␈αvariable␈αis␈αbound.␈α Thus
␈↓ ↓H␈↓it␈α⊂would␈α⊂be␈α⊂wrong␈α⊂to␈α⊂substitute␈α⊂␈↓αx + y␈↓␈α⊃for␈α⊂␈↓αx␈↓␈α⊂in␈α⊂␈↓α∀y:[x + y = z]␈↓␈α⊂or␈α⊂into␈α⊂the␈α⊃term␈α⊂␈↓α[λy:x + y][u + v]␈↓.
␈↓ ↓H␈↓Before␈α
doing␈α
the␈αsubstitution,␈α
the␈α
variable␈α␈↓αy␈↓␈α
would␈α
have␈αto␈α
be␈α
replaced␈αin␈α
all␈α
its␈αbound␈α
occurrences
␈↓ ↓H␈↓by a fresh variable.
␈↓ ↓H␈↓ Lambda-expressions␈α⊗can␈α⊗always␈α⊗be␈α⊗eliminated␈α⊗from␈α⊗sentences␈α⊗and␈α⊗terms␈α⊗by␈α∃lambda-
␈↓ ↓H␈↓conversion,␈αbut␈αthe␈αexpression␈αmay␈αincrease␈αgreatly␈αin␈αlength␈αif␈αa␈αlengthy␈αterm␈αreplaces␈αa␈αvariable
␈↓ ↓H␈↓that␈α∂occurs␈α∂more␈α∞than␈α∂once␈α∂in␈α∞␈↓αe␈↓.␈α∂ It␈α∂is␈α∞easy␈α∂to␈α∂make␈α∞an␈α∂expression␈α∂of␈α∞length␈α∂␈↓αn␈↓␈α∂whose␈α∂length␈α∞is
␈↓ ↓H␈↓increased to 2␈↓εn␈↓ by converting its ␈↓αn␈↓ nested lambda-expressions.
␈↓ ↓H␈↓4. ␈↓βAlgebraic axioms for S-expressions and lists.␈↓
␈↓ ↓H␈↓ The␈α⊂algebraic␈α⊂facts␈α⊂about␈α⊂S-expressions␈α⊂are␈α∂expressed␈α⊂by␈α⊂the␈α⊂following␈α⊂sentences␈α⊂of␈α∂first
␈↓ ↓H␈↓order logic:
␈↓ ↓H␈↓ ␈↓α∀x.(issexp x ⊃ ␈↓βat␈↓α x ∨ (issexp ␈↓βa␈↓α x ∧ issexp ␈↓βd␈↓α x ∧ x = (␈↓βa␈↓α x . ␈↓βd␈↓α x)))␈↓
␈↓ ↓H␈↓and
␈↓ ↓H␈↓ ␈↓α∀x y.(issexp x ∧ issexp y ⊃ issexp(x.y) ∧ ¬␈↓βat␈↓α(x.y) ∧ x = ␈↓βa␈↓α(x.y) ∧ y = ␈↓βd␈↓α(x.y))␈↓.
␈↓ ↓H␈↓Here␈α
␈↓αissexp␈α
e␈↓␈αasserts␈α
that␈α
the␈α
object␈α␈↓αe␈↓␈α
is␈α
an␈αS-expression␈α
so␈α
that␈α
the␈αsentences␈α
used␈α
in␈α
proving␈αa
␈↓ ↓H␈↓particular␈α∞program␈α
correct␈α∞can␈α
involve␈α∞other␈α
kinds␈α∞of␈α∞entities␈α
as␈α∞well.␈α
If␈α∞we␈α
can␈α∞assume␈α∞that␈α
all
␈↓ ↓H␈↓objects␈α
are␈α
S-expressions␈α
or␈α∞can␈α
declare␈α
certain␈α
variables␈α∞as␈α
ranging␈α
only␈α
over␈α∞S-expressions,␈α
we
␈↓ ↓H␈↓can simplify the axioms to
␈↓ ↓H␈↓ ␈↓α∀x.[␈↓βat␈↓α x ∨ x = [␈↓βa␈↓α x . ␈↓βd␈↓α x]]␈↓
␈↓ ↓H␈↓and
␈↓ ↓H␈↓ ␈↓α∀x y.[¬␈↓βat␈↓α[x.y] ∧ x = ␈↓βa␈↓α[x.y] ∧ y = ␈↓βd␈↓α[x.y]]␈↓.
␈↓ ↓H␈↓␈↓ ¬wCHAPTER I␈↓ I6
␈↓ ↓H␈↓ The algebraic facts about lists are expressed by the following sentences of first order logic:
␈↓ ↓H␈↓ ␈↓α∀x. islist x ⊃ x = ␈↓∧NIL␈↓α ∨ islist ␈↓βd ␈↓αx␈↓,
␈↓ ↓H␈↓ ␈↓α∀x y. islist y ⊃ islist[x . y]␈↓,
␈↓ ↓H␈↓ ␈↓α∀x y. islist y ⊃ ␈↓βa␈↓α[x . y] = x ∧ ␈↓βd␈↓α[x.y] = y␈↓.
␈↓ ↓H␈↓We␈α
can␈α
rarely␈α
assume␈αthat␈α
everything␈α
is␈α
a␈αlist,␈α
because␈α
the␈α
lists␈αusually␈α
contain␈α
atoms␈α
which␈αare␈α
not
␈↓ ↓H␈↓themselves lists.
␈↓ ↓H␈↓ These␈α∞axioms␈α∞are␈α∞analogous␈α∞to␈α∞the␈α∞algebraic␈α∞part␈α∞of␈α∞Peano's␈α∞axioms␈α∞for␈α∂the␈α∞non-negative
␈↓ ↓H␈↓integers.␈α The␈α
analogy␈αcan␈α
be␈αmade␈α
clear␈αif␈α
we␈αwrite␈α
Peano's␈αaxioms␈α
using␈α␈↓αn'␈↓␈α
for␈αthe␈α
successor␈αof␈α
␈↓αn␈↓
␈↓ ↓H␈↓and ␈↓αn␈↓ε-␈↓ for the predecessor of ␈↓αn␈↓. Peano's algebraic axioms then become
␈↓ ↓H␈↓ ␈↓α∀n: n' ≠ 0␈↓,
␈↓ ↓H␈↓ ␈↓α∀n: (n')␈↓ε-␈↓α = n␈↓,
␈↓ ↓H␈↓and
␈↓ ↓H␈↓ ␈↓α∀n: n ≠ 0 ⊃ (n␈↓ε-␈↓α)' = n␈↓.
␈↓ ↓H␈↓Integers␈αspecialize␈α lists␈α
if␈αwe␈αidentify␈α0␈α
with␈α␈↓∧NIL␈↓␈αand␈α
assume␈αthat␈αthere␈αis␈α
only␈αone␈αobject␈α
(say␈α1)
␈↓ ↓H␈↓that can serve as a list element. Then ␈↓αn' = cons[1,n]␈↓, and ␈↓αn␈↓ε-␈↓α = ␈↓βd␈↓α n␈↓.
␈↓ ↓H␈↓ Clearly␈α∂S-expressions␈α∂and␈α∂lists␈α∂satisfy␈α∂the␈α∂axioms␈α∂given␈α∂for␈α∂them,␈α∂but␈α∂unfortunately␈α∞these
␈↓ ↓H␈↓algebraic␈α∂axioms␈α⊂are␈α∂insufficient␈α∂to␈α⊂characterize␈α∂them.␈α⊂ For␈α∂example,␈α∂consider␈α⊂a␈α∂domain␈α⊂of␈α∂one
␈↓ ↓H␈↓element ␈↓↓a␈↓ satisfying
␈↓ ↓H␈↓ ␈↓βa␈↓α a = ␈↓βd␈↓α a = a . a = a␈↓.
␈↓ ↓H␈↓It␈α
satisfies␈α
the␈αalgebraic␈α
axioms␈α
for␈αS-expressions.␈α
We␈α
can␈α
exclude␈αit␈α
by␈α
an␈αaxiom␈α
␈↓α∀x.(␈↓βa␈↓α␈α
x␈α
≠␈αx)␈↓,
␈↓ ↓H␈↓but␈α
this␈α∞won't␈α
exclude␈α
other␈α∞circular␈α
list␈α
structures␈α∞that␈α
eventually␈α
return␈α∞to␈α
the␈α
same␈α∞element␈α
by
␈↓ ↓H␈↓some␈α
␈↓βa-d␈↓␈αchain.␈α
Actually␈α
we␈αwant␈α
to␈α
exclude␈αall␈α
infinite␈α
chains,␈αbecause␈α
most␈α
LISP␈αprograms␈α
won't
␈↓ ↓H␈↓terminate␈α∞unless␈α
every␈α∞␈↓βa-d␈↓␈α
chain␈α∞eventually␈α
terminates␈α∞in␈α
an␈α∞atom.␈α
This␈α∞cannot␈α
be␈α∞done␈α∞by␈α
any
␈↓ ↓H␈↓finite set of axioms.
␈↓ ↓H␈↓5. ␈↓βAxiom schemas of induction.␈↓
␈↓ ↓H␈↓ ␈α∞ In␈α
order␈α∞to␈α
exclude␈α∞infinite␈α
list␈α∞structures␈α
we␈α∞need␈α
axioms␈α∞of␈α
induction␈α∞analogous␈α
to
␈↓ ↓H␈↓Peano's induction axiom. Peano's axiom is ordinarily written
␈↓ ↓H␈↓ ␈↓αP(0) ∧ ∀n:(P(n) ⊃ P(n')) ⊃ ∀n:P(n)␈↓.
␈↓ ↓H␈↓␈↓ ¬wCHAPTER I␈↓ I7
␈↓ ↓H␈↓Here␈α∞␈↓αP(n)␈↓␈α∞is␈α∞an␈α∞arbitrary␈α∞predicate␈α∞of␈α∞integers,␈α∞and␈α∞we␈α∞get␈α∞particular␈α∞instances␈α∞of␈α∞the␈α∞axiom␈α∞by
␈↓ ↓H␈↓substituting particular predicates.
␈↓ ↓H␈↓Peano's induction schema can also be written
␈↓ ↓H␈↓ ␈↓α∀n:(n = 0 ∨ P(n␈↓ε-␈↓α) ⊃ P(n)) ⊃ ∀n:P(n)␈↓,
␈↓ ↓H␈↓and the equivalence of the two forms is easily proved.
␈↓ ↓H␈↓ The S-expression analog is
␈↓ ↓H␈↓ ␈↓α∀x:[issexp x ⊃ [␈↓βat␈↓α x ∨ P[␈↓βa␈↓α x] ∧ P[␈↓βd␈↓α x] ⊃ P[x]]] ⊃ ∀x:[issexp x ⊃ P[x]]␈↓,
␈↓ ↓H␈↓or, assuming everything is an S-expression
␈↓ ↓H␈↓ ␈↓α∀x:[␈↓βat␈↓α x ∨ P[␈↓βa␈↓α x] ∧ P[␈↓βd␈↓α x] ⊃ P[x]] ⊃ ∀x:P[x]␈↓.
␈↓ ↓H␈↓ The corresponding axiom schema for lists is
␈↓ ↓H␈↓ ␈↓α∀u:[islist u ⊃ [␈↓βn␈↓α u ∨ P[␈↓βd␈↓α u] ⊃ P[u]]] ⊃ ∀u:[islist u ⊃ P[u]]␈↓.
␈↓ ↓H␈↓ These␈α⊂schemas␈α⊂are␈α⊂called␈α∂principles␈α⊂of␈α⊂␈↓αstructural␈α⊂induction␈↓,␈α∂since␈α⊂the␈α⊂induction␈α⊂is␈α⊂on␈α∂the
␈↓ ↓H␈↓structure of the entities involved.
␈↓ ↓H␈↓6. ␈↓βProofs by structural induction.␈↓
␈↓ ↓H␈↓ Recall that the operation of appending two lists is defined by
␈↓ ↓H␈↓␈↓α1.1)␈↓ α8 u * v ← ␈↓βif n␈↓α u ␈↓βthen␈↓α v ␈↓βelse a␈↓α u . [␈↓βd␈↓α u * v]␈↓.
␈↓ ↓H␈↓Because␈α
␈↓αu*v␈↓␈α
is␈α
defined␈α
for␈α∞all␈α
␈↓αu␈↓␈α
and␈α
␈↓αv␈↓,␈α
i.e.␈α
the␈α∞computation␈α
described␈α
above␈α
terminates␈α
for␈α∞all␈α
␈↓αu␈↓
␈↓ ↓H␈↓and ␈↓αv␈↓, we can replace (1.1) by the sentence
␈↓ ↓H␈↓␈↓α1.2)␈↓ α8 ∀u v:[islist u ∧ islist v ⊃ [u * v = ␈↓βif n␈↓α u ␈↓βthen␈↓α v ␈↓βelse a␈↓α u . [␈↓βd␈↓α u * v]]]␈↓.
␈↓ ↓H␈↓Now␈α
suppose␈αwe␈α
would␈αlike␈α
to␈αprove␈α
␈↓α∀v:[␈↓∧NIL␈↓α␈α*␈α
v␈α=␈α
v]␈↓.␈α This␈α
is␈αquite␈α
trivial;␈αwe␈α
need␈αonly␈α
substitute
␈↓ ↓H␈↓␈↓∧NIL␈↓ for ␈↓αx␈↓ in (1.2), getting
␈↓ ↓H␈↓␈↓ αG␈↓∧NIL␈↓α * v ␈↓ β( = ␈↓βif n ␈↓∧NIL ␈↓βthen␈↓α v ␈↓βelse a ␈↓∧NIL␈↓α . [␈↓βd ␈↓∧NIL␈↓α * v]
␈↓ ↓H␈↓α␈↓ β( = v␈↓.
␈↓ ↓H␈↓Next␈αconsider␈αproving␈α␈↓α∀u:[u␈α*␈α␈↓∧NIL␈↓α␈α
=␈αu]␈↓.␈α This␈αcannot␈αbe␈αdone␈α
by␈αsimple␈αsubstitution,␈αbut␈αit␈αcan␈α
be
␈↓ ↓H␈↓done as follows: First substitute ␈↓αλu:[u * ␈↓∧NIL␈↓α = u]␈↓ for ␈↓αP␈↓ in the induction schema
␈↓ ↓H␈↓␈↓ ¬wCHAPTER I␈↓ I8
␈↓ ↓H␈↓ ␈↓α∀u:[islist u ⊃ [␈↓βn␈↓α u ∨ P[␈↓βd␈↓α u] ⊃ P[u]]] ⊃ ∀u:[islist u ⊃ P[u]]␈↓,
␈↓ ↓H␈↓getting
␈↓ ↓H␈↓ ␈↓α∀u:[islist␈α
u␈α⊃␈α
[␈↓βn␈↓α␈α
u␈α∨␈α
λu:[u␈α*␈α
␈↓∧NIL␈↓α␈α
=␈αu][␈↓βd␈↓α␈α
u]␈α
⊃␈αλu:[u␈α
*␈α␈↓∧NIL␈↓α␈α
=␈α
u][u]]]␈α⊃␈α
∀u:[islist␈α
u␈α⊃␈α
λu:[u␈α*␈α
␈↓∧NIL␈↓α
␈↓ ↓H␈↓α= u][u]]␈↓.
␈↓ ↓H␈↓Carrying out the indicated lambda conversions makes this
␈↓ ↓H␈↓␈↓α1.3)␈↓ α8 ∀u:[islist u ⊃ [␈↓βn␈↓α u ∨ ␈↓βd␈↓α u * ␈↓∧NIL␈↓α = ␈↓βd␈↓α u] ⊃ u * ␈↓∧NIL␈↓α = u] ⊃ ∀u:[islist u ⊃ u * ␈↓∧NIL␈↓α = u]␈↓.
␈↓ ↓H␈↓ Next␈αwe␈αmust␈αuse␈αthe␈αrecursive␈αdefinition␈αof␈α␈↓αu*v␈↓.␈α There␈αare␈αtwo␈αcases␈αaccording␈αto␈αwhether
␈↓ ↓H␈↓␈↓βn␈↓␈α
␈↓αu␈↓␈α
or␈α
not.␈α In␈α
the␈α
first␈α
case,␈α
we␈αsubstitute␈α
␈↓∧NIL␈↓␈α
for␈α
␈↓αv␈↓␈α
and␈αget␈α
␈↓∧NIL␈↓*␈↓∧NIL␈↓_=_␈↓∧NIL␈↓,␈α
and␈α
in␈α
the␈αsecond␈α
case
␈↓ ↓H␈↓we␈α∩use␈α∩the␈α∩hypothesis␈α⊃␈↓βd␈↓_u_*_␈↓∧NIL␈↓_=_␈↓βd␈↓_u␈α∩and␈α∩the␈α∩third␈α∩algebraic␈α⊃axiom␈α∩for␈α∩lists␈α∩to␈α∩make␈α⊃the
␈↓ ↓H␈↓simplification
␈↓ ↓H␈↓␈↓α1.4)␈↓ α8 ␈↓βa␈↓α u . [␈↓βd␈↓α u * ␈↓∧NIL␈↓α] = ␈↓βa␈↓α u . ␈↓βd␈↓α u = u.
␈↓ ↓H␈↓αCombining␈αthe␈αcases␈αgives␈αthe␈αhypothesis␈αof␈α(1.3)␈αand␈αhence␈αits␈αconclusion,␈αwhich␈αis␈αthe␈αstatement␈αto
␈↓ ↓H␈↓αbe proved.